<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.01.
   家居公司留言模型($$)*/

!defined('Q_PATH') && exit;

class JiajucompanyguestbookModel extends CommonModel{

	static public function init__(){
		return array(
			'table_name'=>'jiajucompanyguestbook',
			'autofill'=>array(
				array('user_id','userId','create','callback'),
				array('jiajucompanyguestbook_ip','getIp','create','callback'),
				array('jiajucompanyguestbook_edituserid','userId','all','callback'),
				array('jiajucompanyguestbook_editusername','userName','all','callback'),
			),
			'check'=>array(
				'jiajucompanyguestbook_name'=>array(
					array('require',Q::L('留言名字不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('max_length',50,Q::L('留言名字不能超过50个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajucompanyguestbook_content'=>array(
					array('require',Q::L('留言内容不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('max_length',250,Q::L('留言内容不能超过250个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajucompanyguestbook_mobile'=>array(
					array('require',Q::L('留言手机号码不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('mobile',Q::L('留言手机号码格式错误','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajucompanyguestbook_qq'=>array(
					array('require',Q::L('留言QQ不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('max_length',20,Q::L('留言QQ不能超过20个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
			),
		);
	}

	static function F(){
		$arrArgs=func_get_args();
		return ModelMeta::instance(__CLASS__)->findByArgs($arrArgs);
	}

	static function M(){
		return ModelMeta::instance(__CLASS__);
	}

	protected function beforeSave_(){
		$this->jiajucompanyguestbook_name=C::text($this->jiajucompanyguestbook_name);
		$this->jiajucompanyguestbook_content=C::text($this->jiajucompanyguestbook_content);
		$this->jiajucompanyguestbook_qq=C::text($this->jiajucompanyguestbook_qq);
		$this->jiajucompanyguestbook_mobile=C::text($this->jiajucompanyguestbook_mobile);
		$this->jiajucompanyguestbook_replyusername=C::text($this->jiajucompanyguestbook_replyusername);
		$this->jiajucompanyguestbook_replycontent=C::text($this->jiajucompanyguestbook_replycontent);
		$this->jiajucompanyguestbook_editusername=C::text($this->jiajucompanyguestbook_editusername);
	}

}
